﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Homework09
{
    //作业9:编程实现输入验证码不区分大小写
    internal class Homework09
    {
        static void Main(string[] args)
        {
            int count = 0;
            string[] arr = { "aBCd" };
            bool flag = true;
            //键盘获取验证码
            while (flag)
            {
                Console.WriteLine("--------------------------------");
                Console.WriteLine("请输入验证码(不区分大小写):aBCd");
                string str = Console.ReadLine();
                string[] brr = { str };
                if (brr[0].Length != arr[0].Length)
                {
                    Console.WriteLine($"!!!错误!!!:请输入{arr[0].Length}位数的验证码");
                    Console.WriteLine();
                    continue;
                }
                for (int i = 0; i < arr[0].Length; i++)
                {
                    if (Convert.ToInt32(arr[0][i]) == Convert.ToInt32(brr[0][i]) || Convert.ToInt32(arr[0][i]) - 32 == Convert.ToInt32(brr[0][i]) || Convert.ToInt32(arr[0][i]) + 32 == Convert.ToInt32(brr[0][i]))
                    {
                        count++;
                    }
                }
                if (count == arr[0].Length)
                {
                    Console.WriteLine("输入正确");
                    flag = false;
                }
                else
                {
                    Console.WriteLine("输入错误");
                    flag = false;
                }
            }
        }
    }
}
